<div class="common whiteBg">  
    <fieldset>
        <div class="classListing borB">
            <div class="left">                    
                <?php
                $classImage = '';
                $classCourseId='';
                $userDetails='';
                $emptyImage = '<img src="' . baseUrl() . '../../' . getUploadDir() . '/no-class-image-240X180.jpg"   alt="class" id="classcourse">';
                $rateToTrainerUp = 'thumb-up';
                $rateToTrainerDown = 'thumb-down';
                $rateclassDown = 'thumb-down';
                $rateclassUp = 'thumb-up';
                $criteria = new CDbCriteria();
                $criteria->condition = 'courses_id IS NULL AND classes_id IS NULL AND to_front_user_id IS NOT NULL OR to_back_user_id IS NOT NULL';
                $criteria->addCondition('from_user_id=' . getLoginUserId());
                $rateToTrainer = ClassCourseTrainnerRate::model()->find($criteria);
                $rateToTrainerUp = (!empty($rateToTrainer) AND $rateToTrainer->status != 0 ) ? 'thumb-up-rated' : 'thumb-up';
                $rateToTrainerDown = (!empty($rateToTrainer) AND $rateToTrainer->status != 1) ? 'thumb-down-rated' : 'thumb-down';
                $puracheId = $data->id . $data->users_id;
                $classcriteria = new CDbCriteria();
                $classcriteria->condition = 'to_front_user_id IS NULL AND  to_back_user_id IS  NULL AND courses_id IS NOT NULL OR classes_id IS NOT NULL';
                $classcriteria->addCondition('from_user_id=' . getLoginUserId());

                $classcriterias = ClassCourseTrainnerRate::model()->find($classcriteria);
                $rateclassUp = (!empty($classcriterias) AND $classcriterias->status != 0 ) ? 'thumb-up-rated' : 'thumb-up';
                $rateclassDown = (!empty($classcriterias) AND $classcriterias->status != 1) ? 'thumb-down-rated' : 'thumb-down';

                if (isset($data->purchaseClassCourses[0]->classes_id) && $data->purchaseClassCourses[0]->classes_id != '') {
                    $imagePath = getImagePathByClassCourse('Classes', $data->purchaseClassCourses[0]->classes_id);
                    $userDetails = getUserTypeByClassCourse('Classes', $data->purchaseClassCourses[0]->classes_id);
                    $classImage = ClassImage::getPrimaryImage($data->purchaseClassCourses[0]->classes_id);
                    $classTitle = getClassName($data->purchaseClassCourses[0]->classes_id);
                    $classCourseId = $data->purchaseClassCourses[0]->classes_id;
                    $classModel = getClaCourseInfo('Classes', $data->purchaseClassCourses[0]->classes_id);
                    $authKey=$classModel->auth_key;
                    $userId=($classModel->users_id=='')?$classModel->backend_user_id:$classModel->users_id;
                    $userType = ($classModel->users_id=='')?'backend':'';
                    
                }
//                if (isset($data->purchaseClassCourses[0]->courses_id) && $data->purchaseClassCourses[0]->courses_id!= '') {
//                    $userType = getImagePathByClassCourse('Classes',$data->purchaseClassCourses[0]->classes_id);
//                    $userDetails = getUserTypeByClassCourse('Classes',$data->purchaseClassCourses[0]->classes_id);
//                }


                echo (!empty($classImage)) ? '<img src="' . baseUrl() . '../../' . SkillConfig::getClassCourseImagePath($imagePath) . 'details-image/' . $classImage . '"  alt="' . $classTitle . '">' : $emptyImage;
                ?>
            </div>
            <div class="right">
                <h4 class="txttTransformNorml txt676 remmarginT"><?php echo ($classCourseId != '') ? 'Class Name:' . $classTitle : 'Course Name:' . ' '; ?></h4>
                <p><span class="font-opensansbd width200 inline-block">Trainer </span>: <?php echo $userDetails->first_name . ' ' . $userDetails->last_name; ?></p>
                <p><span class="font-opensansbd width200 inline-block">Trainer Profile </span>: <?php echo CHtml::link('View Profile', $this->createAbsoluteUrl('users/trainerProfile', array('authKey' => $authKey))); ?></p>
                <p><span class="font-opensansbd width200 inline-block">Order date </span>: <?php echo date('d M Y', strtotime($data->order_date_time)); ?></p>
                <p><span class="font-opensansbd width200 inline-block"><?php echo ($classCourseId != '') ? 'Cost Of Class</span>: ' . ClassBatch::findMinMaxPriceByClassbatchForLearn($classCourseId) : 'Cost Of Course</span>:' . CourseBatche::findMinMaxPriceByClassbatchForLearn(' ') ?> </p>
                <p><span class="font-opensansbd width200 inline-block"><?php echo ($classCourseId != '') ? 'View this Class</span>: ' . CHtml::link('View Details', $this->createAbsoluteUrl('classes/viewClass', array('id' => $classCourseId))) : 'View this Course</span>:' . CHtml::link('View Details', $this->createAbsoluteUrl('courses/viewCourse', array('id' => ' '))) ?> </p>

            </div>    
            <div class="clear"></div>                	                      
        </div>
        <div id='formResult_<?php echo $puracheId; ?>' style='margin:20px;'></div>
        <div id="review_class_box_<?php echo $puracheId; ?>" style="margin: 9px 120px 0px 18px;display:none;" class="reviewclassfromUser">
            <div id="AjaxLoader_<?php echo $puracheId; ?>" style="display:none;" align="center">&nbsp;<img src="<?php echo ThemePath(); ?>/images/fancybox_loading@2x.gif" align="absmiddle"></div>

            <div class="common formElements">
                <label for="write_review_<?php echo $puracheId; ?>">Write you review: <span class="required">*</span></label>
                <div class="clear"></div>
                <input type="hidden" id="get_click_value_review_class_<?php echo $puracheId; ?>">
                <input type="text" id="review_class_course_id_<?php echo $puracheId; ?>" value="<?php echo ($classCourseId != '') ? 'classId':'courseId'; ?>">
                <textarea  class=" requiredfield" id="reviews_text_classe_<?php echo $puracheId; ?>" name="reviews_text"></textarea>
                <div  class="errorMessage" id='errorMessage_msg_class_review_<?php echo $puracheId; ?>'></div>
                <div class="clear"></div>
            </div>

        </div>    
        <div id="trainer_review_class_box_<?php echo $puracheId; ?>" style="margin: 9px 120px 0px 18px;display:none;" class="reviewtrainerfromUser">
            <div class="common formElements">
                <label for="write_review_<?php echo $puracheId; ?>">Write you review: <span class="required">*</span></label>
                <div class="clear"></div>
                <input type="hidden" id="get_click_value_review_trainer_<?php echo $puracheId; ?>">                   
                <textarea  class=" requiredfield" id="reviews_text_trainer_<?php echo $puracheId; ?>" name="reviews_text"></textarea>
                <div  class="errorMessage" id='errorMessage_msg_trainer_review_<?php echo $puracheId; ?>'></div>
                <div class="clear"></div>
            </div>

        </div>


        <div class="padding20px alignR">   
            <div class="ratebtn showClassuserBtn " id="rate_class_btn_<?php echo $puracheId; ?>"><span id="rate_class_up_btn_<?php echo $puracheId; ?>"  class="sprite addmarginR10 <?php echo $rateclassUp; ?>" onclick="rateToClassCourse(<?php echo $puracheId; ?>,<?php echo $classCourseId; ?>, '1')"></span> <span>Rate Class</span> <span id="rate_class_dwn_btn_<?php echo $puracheId; ?>" class="sprite <?php echo $rateclassDown; ?>"  onclick="rateToClassCourse(<?php echo $puracheId; ?>,<?php echo $classCourseId; ?>, '0')"></span></div>
            <div class="ratebtn showClassuserBtn " id="rate_trainer_btn_<?php echo $puracheId; ?>"><span  id="rate_trainer_up_btn_<?php echo $puracheId; ?>" class="sprite addmarginR10 <?php echo $rateToTrainerUp; ?>" onclick="rateTotarinner(<?php echo $puracheId; ?>,<?php echo $userId; ?>,<?php echo "'$userType'"; ?>, '1')"></span> <span>Rate Trainer</span> <span id="rate_trainer_dwn_btn_<?php echo $puracheId; ?>" class="sprite <?php echo $rateToTrainerDown; ?>"  onclick="rateTotarinner(<?php echo $puracheId; ?>,<?php echo $userId; ?>,<?php echo "'$userType'"; ?>, '0')"></span></div>
            <input type="button" class="btn showClassuserBtn" value="<?php echo ($classCourseId != '') ? 'Review Class' : 'Review Course'; ?>" id="review_class_btn_<?php echo $puracheId; ?>" onclick="reviewCourseClasses(<?php echo $puracheId; ?>,<?php echo $classCourseId; ?>)">
            <input type="button" class="btn showClassuserBtn" value="Review Trainer" id="review_trainer_btn_<?php echo $puracheId; ?>" onclick="trainerReviews(<?php echo $puracheId; ?>,<?php echo $userId; ?>,<?php echo "'$userType'"; ?>)">
            <input type="button" class="btn showClassuserBtn" value="Cancel" id="review_cancel_btn_<?php echo $puracheId; ?>" onclick="cancelQuery(<?php echo $puracheId; ?>)" style="display: none;">

        </div>
    </fieldset>

</div>